lib/gpg: Only show gpg-connect-agent stderr on failures
authorDan Nicholson <nicholson@endlessm.com>
Fri, 16 Aug 2019 04:24:54 +0000 (22:24 -0600)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 2 Sep 2019 21:55:14 +0000 (21:55 +0000)
commit522d31b2d4604026f1c0a442887ca9d4b319e9cc
treedc95dbf135820f15e49762e994b03d29253634c0
parentd42f970ed30c1f2f293ee864f32de44b3608b9ac
lib/gpg: Only show gpg-connect-agent stderr on failures

When listing GPG keys, the temporary GPG homedir will be constructed by
simply copying the remote's trusted keys to the pubring.gpg file. In
that case, no GPG operations spawning gpg-agent will be run. When
gpg-connect-agent is run to cleanup the homedir, it will helpfully print
on stderr that it's starting gpg-agent like so:

gpg-connect-agent: no running gpg-agent - starting '/usr/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: connection to agent established

Send gpg-connect-agent's stderr to a pipe and only send it to the
application's stderr if an error was encountered.

Fixes: #1907
Closes: #1908
Approved by: cgwalters
src/libotutil/ot-gpg-utils.c